package com.myh.gulimall.product.pojo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.myh.common.valid.AddGroup;
import com.myh.common.valid.ListValue;
import com.myh.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * @Description: // 类说明，在创建类时要填写
 * @ClassName: BrandPojo    // 类名，会自动填充
 * @Author: MYH          // 创建者
 * @Date: 2024/1/25 17:44   // 时间
 * @Version: 1.0     // 版本
 */
@Data
@TableName("pms_brand")
public class BrandPojo implements Serializable {
    private static final long serialVersionUID = 1L;


    /**
     * 品牌名
     */
    @NotBlank(message = "品牌名字段不能为空", groups = AddGroup.class)
    private String name;
    /**
     * 品牌logo地址
     */
    @NotBlank(message = "品牌logo地址不能为空", groups = AddGroup.class)
    @URL(message = "logo必须是一个合法的URL地址", groups = {AddGroup.class, UpdateGroup.class})
    private String logo;
    /**
     * 介绍
     */
    @NotBlank(message = "介绍字段不能为空", groups = AddGroup.class)
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(message = "显示状态不能为空", groups = AddGroup.class)
    @ListValue(values = {0, 1}, message = "显示状态只能为0或1", groups = {AddGroup.class, UpdateGroup.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotBlank(message = "检索首字母字段不能为空", groups = AddGroup.class)
    @Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须是一个字母", groups = {AddGroup.class, UpdateGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(message = "排序字段不能为空", groups = AddGroup.class)
    @Min(value = 0, message = "排序字段为一个非负整数", groups = {AddGroup.class, UpdateGroup.class})
    private Integer sort;

}

